<include file="Public/header" />
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>系统用户管理</h3>
      <ul class="tab-base">
        <li><a href="{:U('Setting/admin_list')}"><span>管理</span></a></li>
        <li><a href="JavaScript:void(0);" class="current"><span>编辑</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="add_form" method="post" action="{:U('Setting/admin_list',array('op'=>'edit'))}">
    <table class="table tb-type2 nobdb">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label for="admin_name">账号:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform">{$vo['admin_name']}</td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label for="admin_password">密码:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="password" id="admin_pwd" name="admin_pwd" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>
		<tr>
          <td colspan="2" class="required"><label for="admin_repwd">确认密码:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="password" id="admin_repwd" name="admin_repwd" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>
       <if condition="$vo['admin_issuper'] neq 1"> 
		<tr>
          <td colspan="2" class="required"><label for="admin_auth">用户权限:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform" colspan="2">
          <volist name="admin_auth" id="at">
          <input name="admin_auth[]" type="checkbox" value="{$at['a_id']}" <?php if(in_array($at['a_id'],$auth))echo'checked';?>/>{$at['a_title']} &nbsp;&nbsp;
          </volist>
          </td>
        </tr>                  
      </if>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="2">
          	<input type='hidden' name='admin_id' value="{$vo['admin_id']}">
          	<a href="JavaScript:void(0);" class="btn" id="submitBtn"><span>保存</span></a>
          </td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<script>
//按钮先执行验证再提交表
$(function(){$("#submitBtn").click(function(){
    if($("#add_form").valid()){
     $("#add_form").submit();
	}
	});
});
$(document).ready(function(){
	$("#add_form").validate({
		errorPlacement: function(error, element){
			error.appendTo(element.parent().parent().prev().find('td:first'));
        },
        success: function(label){
            label.addClass('valid');
        },
        rules : {
            admin_pwd : {
               // required : true,
				minlength: 6,
				maxlength: 20
            },
			admin_repwd:{
				//required: true,	
				equalTo:'#admin_pwd'
			}
        },
        messages : {
            admin_pwd : {
                //required : '请输入密码',
				minlength: '密码长度为6-20个字符',
				maxlength: '密码长度为6-20个字符'
            },
			admin_repwd:{
				//required: '请再次输入密码',
				equalTo:'两次输入的密码不一致'
			}
        }
	});
});
</script> 
<include file="Public/footer" />